<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>pvsosc</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="pvsout.html" title="pvsout" />
    <link rel="next" href="pvspitch.html" title="pvspitch" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">pvsosc</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="pvsout.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="pvspitch.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="pvsosc"></a>
      <div class="titlepage"></div>
      <a id="Indexpvsosc" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">pvsosc</span>
        </h2>
        <p>pvsosc — 
      PVS-based oscillator simulator.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp139593856"></a>
        <h2>Description</h2>
        <p>
      Generates periodic signal spectra in AMP-FREQ format, with the option of four wave types:
      </p>
        <div class="orderedlist">
          <ol class="orderedlist" type="1">
            <li class="listitem">sawtooth-like (harmonic weight 1/n, where n is partial number)</li>
            <li class="listitem">square-like (similar to 1., but only odd partials)</li>
            <li class="listitem">pulse (all harmonics with same weight)</li>
            <li class="listitem">cosine</li>
          </ol>
        </div>
        <p>
      Complex waveforms (ie. all types except cosine) contain all harmonics up to the Nyquist. This makes pvsosc an option for generation of band-limited periodic waves. In addition, types can be changed using a k-rate variable.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp139598832"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">fsig <span class="command"><strong>pvsosc</strong></span> kamp, kfreq, ktype, isize [,ioverlap] [, iwinsize] [, iwintype] [, iformat]</pre>
      </div>
      <div class="refsect1">
        <a id="idp139648496"></a>
        <h2>Initialisation</h2>
        <p>
      <span class="emphasis"><em>fsig</em></span> -- output pv stream set to zero.
    </p>
        <p>  
      <span class="emphasis"><em>isize</em></span> -- size of analysis frame and window.
    </p>
        <p>
      <span class="emphasis"><em>ioverlap</em></span> -- (Optional) size of overlap, defaults to isize/4.
    </p>
        <p>
      <span class="emphasis"><em>iwinsize</em></span> -- (Optional) window size, defaults to isize.
    </p>
        <p>
      <span class="emphasis"><em>iwintype</em></span> -- (Optional) window type, defaults to Hanning. The choices are currently:
      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" style="list-style-type: disc; ">
            <li class="listitem">
              <p>0 = Hamming window</p>
            </li>
            <li class="listitem">
              <p>1 = von Hann window</p>
            </li>
          </ul>
        </div>
        <p>
    </p>
        <p>
      <span class="emphasis"><em>iformat</em></span> -- (Optional) data format, defaults to 0 which produces AMP:FREQ data. That is currently the only option.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp139656512"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kamp</em></span> -- signal amplitude. Note that the actual signal amplitude can, 
	  depending on wave type and frequency, vary slightly above or below this value. Generally
	  the amplitude will tend to exceed kamp on higher frequencies (&gt; 1000 Hz) and be reduced on
	  lower ones. Also due to the overlap-add process, when resynthesing with pvsynth, frequency
	  glides will cause the output amplitude to fluctuate above and below kamp.
    </p>
        <p>  
	<span class="emphasis"><em>kfreq</em></span> -- fundamental frequency in Hz.
    </p>
        <p>
      <span class="emphasis"><em>ktype</em></span> -- wave type: 1. sawtooh-like, 2.square-like, 3.pulse and any other
	  value for cosine.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp139660928"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the pvsosc opcode. It uses the file <a class="ulink" href="examples/pvsosc.csd" target="_top"><em class="citetitle">pvsosc.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp139662784"></a>
          <p class="title">
            <strong>Example 709. Example of the pvsosc opcode</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in</span>
-odac           -iadc    <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o pvsosc.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 4410
<span class="ohdr">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="oblock">instr</span> 1
<span class="comment">; a band-limited sawtooth-wave oscillator		</span>
fsig  <span class="opc">pvsosc</span>   10000, 440, 1, 1024 <span class="comment">; generate wave spectral signal</span>
asig <span class="opc">pvsynth</span> fsig                       <span class="comment">; resynthesise it</span>
<span class="opc">out</span> asig
<span class="oblock">endin</span>

<span class="oblock">instr</span> 2
<span class="comment">; a band-limited square-wave oscillator		</span>
fsig  <span class="opc">pvsosc</span>   10000, 440, 2, 1024 <span class="comment">; generate wave spectral signal</span>
asig <span class="opc">pvsynth</span> fsig                       <span class="comment">; resynthesise it</span>
<span class="opc">out</span> asig
<span class="oblock">endin</span>


<span class="oblock">instr</span> 3
<span class="comment">; a pulse oscillator		</span>
fsig  <span class="opc">pvsosc</span>   10000, 440, 3, 1024 <span class="comment">; generate wave spectral signal</span>
asig <span class="opc">pvsynth</span> fsig                       <span class="comment">; resynthesise it</span>
<span class="opc">out</span> asig
<span class="oblock">endin</span>

<span class="oblock">instr</span> 4
<span class="comment">; a cosine-wave oscillator		</span>
fsig  <span class="opc">pvsosc</span>   10000, 440, 4, 1024 <span class="comment">; generate wave spectral signal</span>
asig <span class="opc">pvsynth</span> fsig                       <span class="comment">; resynthesise it</span>
<span class="opc">out</span> asig
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span> 1 0 1
<span class="stamnt">i</span> 2 2 1
<span class="stamnt">i</span> 3 4 1
<span class="stamnt">i</span> 4 6 1

<span class="stamnt">e</span>

<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp139667072"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="pvsanal.html" title="pvsanal"><em class="citetitle">pvsanal</em></a>,
      <a class="link" href="pvsynth.html" title="pvsynth"><em class="citetitle">pvsynth</em></a>,
      <a class="link" href="pvsadsyn.html" title="pvsadsyn"><em class="citetitle">pvsadsyn</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp139671104"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Victor Lazzarini</td>
          </tr>
          <tr>
            <td>August 2006 </td>
          </tr>
        </table>
        <p>
    </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="pvsout.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="pvspitch.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">pvsout </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> pvspitch</td>
        </tr>
      </table>
    </div>
  </body>
</html>
